<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>支付</title>
</head>
<body>
<script>
    function onBridgeReady(){
        let data = JSON.parse('{$pay_data}');
        WeixinJSBridge.invoke(
            'getBrandWCPayRequest', {
                "appId": data.appId,
                "nonceStr":data.nonceStr,
                "package": data.package,
                "paySign": data.paySign,
                "signType": data.signType,
                "timeStamp": data.timeStamp
            },
            function(res){
                if(res.err_msg == "get_brand_wcpay_request:ok" ){
                    window.location.href = '/Phone/Extension/pullCoupon';
                } else {
                    window.location.href = '/Phone/Extension/index';
                }
            });
    }


    if (typeof WeixinJSBridge == "undefined"){
        if( document.addEventListener ){
            document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
        }else if (document.attachEvent){
            document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
            document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
        }
    }else{
        onBridgeReady();
    }

</script>
</body>
</html>